<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserWaterTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_water', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("user_id")->default(0)->comment("用户id");
            $table->integer("water_last_num")->default(0)->comment("剩余水量");
            $table->integer("water_stock_num")->default(0)->comment("客户库存水量");
            $table->integer("water_empty_num")->default(0)->comment("客户压桶装水量");
            $table->softDeletes();
            $table->timestamps();
        });
        Schema::create('user_water_order', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("user_id")->default(0)->comment("用户id");
            $table->integer("account_num")->default(0)->comment("预订水量");
            $table->timestamp("delivery_day")->nullable()->comment("配送日期");
            $table->string("delivery_time")->nullable()->comment("配送时间段");
            $table->string("delivery_type")->nullable()->comment("配送方式，self自提，service配送");
            $table->string("province")->nullable()->comment("配送省份");
            $table->string("city")->nullable()->comment("配送城市");
            $table->string("area")->nullable()->comment("配送地区");
            $table->string("address")->nullable()->comment("具体地址");
            $table->integer("floor")->default(1)->comment("楼层");
            $table->integer("has_lift")->default(1)->comment("是否有电梯");
            $table->integer("status")->default(0)->comment("预订状态，0预订，1确认，2配送中，3完成");
            $table->softDeletes();
            $table->timestamps();
        });
        Schema::create('user_water_use', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("user_id")->default(0)->comment("用户id");
            $table->string("device_num")->nullable()->comment("设备号");
            $table->string("use_num")->nullable()->comment("使用数量");
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_water');
    }
}
